#pragma once

#include <maya/MPxFileTranslator.h>
#include <vector>

using namespace std;

struct Mesh;
class MFnMesh;

class FileTranslator : public MPxFileTranslator
{
	vector<Mesh*> meshesToFile;
public:
	FileTranslator(void) { }
	~FileTranslator(void) { }


	//////////////////////////////////////////////////////////////////////////////////////
	// Functions that must be specifically written to override parent's virtual versions//
	//////////////////////////////////////////////////////////////////////////////////////

	//creator function is used to initialize plug in
	static void * creator(void);

	//the writer function gets called when you export, this is where the magic will happen
	virtual MStatus writer(const MFileObject& file, const MString& optionString, FileAccessMode mode) override;

	//Maya checks to see if we have over written its base writer function, as long as we have 
	//a writer function, this will always return true 
	virtual bool haveWriteMethod(void) const override { return true; }

	//this sets the default extension that Maya appends to our file name when we export
	virtual MString defaultExtension() const override { return "mdl"; }
	//this is used to filter files when the save file dialog box opens
	virtual MString filter() const override { return "*.mdl"; }

	//////////////////////////////////////////////////////////////////////////////////////
	/////////////////// End Functions that MUST be written by us//////////////////////////
	//////////////////////////////////////////////////////////////////////////////////////

	
	bool WriteMesh(MFnMesh& currMesh, Mesh& meshToWrite);
	void FlushFileXML(const char* filename);
	void FlushFileBinary(const char* filename);
//	void ReadAnimation(MPlug& plug, MObjectArray& arr);
};